#!/bin/sh
if [ -z $1 ];then
hive_db=default
else
hive_db=$1
fi

if [ -z $2 ];then
create_time=`date  "+%Y-%m-%d %H-%M-%S"`
else
create_time=$2
fi

hiveconfig=$(cat <<"EOF" /home/hdfs/parquet_shell/hive_parquet_scripts/hive.config
EOF
)

sql_suffix=$(cat <<EOF
        INSERT INTO TABLE dongfeng.navinfo_parquet_d008 PARTITION (part_time,hashtid) SELECT  terminalid ,serialnumber ,retransmission ,version ,depotlogo ,receivedate ,gpsdate ,latitude ,longitude ,originallat ,originallng ,direction ,height,staticsdatamap ,'${create_time}',part_time,hashtid FROM dongfeng.navinfo_stage_d008;
EOF
)
sql="${hiveconfig}${sql_suffix}"
############  execute begin   ###########
hive -e  "$sql"
#echo $sql
